<?php

class Core_Controller_Admincp_Phrase_Add extends Nuo_Controller_Admincp
{
	function execute($request)
	{
		$table = Nuo::getTable('core/phrase');

		$form = Nuo::getObject('core/admincp/phrase/add', 'form');

		if ($request -> isPost() && $form -> isValid($_POST))
		{
			$data = $form -> getData();

			$item = $table -> fetchNew();

			$item -> phrase_id = $id;

			$item -> fromArray($data);

			$item -> updated_at = time();

			$item -> save();

			return  array('jscript' => 'nuo.refresh();');
			return;

			// Nuo::redirect('admincp/core/phrase');
		}

		return  Nuo::getView()->render('core/view/controller/admincp/edit', array('form' => $form));
	}

}
